package demo1;

public class Tect {
    public static void tect(Animal animal){
        animal.eat();
    }
    public static void main(String[] args) {
        Dog dog1 = new Dog("大黄",2);
        tect(dog1);
        dog1.bark();
        Bird bird1 = new Bird("啾啾",8);
        tect(bird1);
        bird1.fly();
        Animal animal1 = new Dog("拉布拉多",8);
        animal1.eat();
        if(animal1 instanceof Bird){
            Bird bird2 = (Bird)  animal1;
            bird2.fly();
        }else {
            Dog dog2 = (Dog) animal1;
            dog2.bark();
        }

    }
}
